﻿/****************************
 * Penn State University 2009
 * Absolute Zero team
 * Serge Tsalyuk, Ameen Mirdamadi, Hugh Harron, George Slota
 * 
 * Variable.cs
 *
 * This class represents and input or an output object
****************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace NN
{
    public class Variable
    {
        private List<double> theData;

        //"Independent" == input, "Dependent" == output
        public String Type { get; set; }

        //This property holds the name of this variable
        public String VariableName { get; set; }

        public double LowerBounds { get; set; }

        public double UpperBounds { get; set; }

        public Variable()
        {
            theData = new List<double>();          
        }

        public List<double> GetPoints()
        {
            return theData;
        }

        public int PointCount()
        {
            return theData.Count;
        }

        public void SetData(List<double> dataSource)
        {
            theData = dataSource;
        }

        public void Add(double value)
        {
            theData.Add(value);
        }

        public void calculateRange()
        {
            double lowestBound, highestBound, currentValue;

            if (theData.Count > 0)
            {
                lowestBound = theData.ElementAt(0);
                highestBound = lowestBound;
                for (int j = 0; j < theData.Count; j++)
                {
                    //currentValue = theInputDataList.ElementAt(i).ElementAt(j);
                    currentValue = theData.ElementAt(j);
                    if (currentValue <= lowestBound)
                    {
                        lowestBound = currentValue;
                    }
                    if (currentValue >= highestBound)
                    {
                        highestBound = currentValue;
                    }
                }

                this.LowerBounds = lowestBound;
                this.UpperBounds = highestBound;
            }
        }



    }
}